package com.dream.myqiyi.db;

import java.sql.SQLException;

import com.dream.myqiyi.dao.NoteTagsModel;
import com.dream.myqiyi.dao.TagModel;
import com.j256.ormlite.dao.BaseDaoImpl;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.dao.DaoManager;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.table.TableUtils;

public class NoteTagsDaoImpl extends BaseDaoImpl<NoteTagsModel, Integer> implements NoteTagsDao {
	Dao<NoteTagsModel, Integer> noteTagsDao;
	
	public NoteTagsDaoImpl(ConnectionSource connectionSource) throws SQLException {
		super(connectionSource, NoteTagsModel.class);
	}
	
	public void performDBOperations(ConnectionSource connectionSource) throws SQLException {
		noteTagsDao = DaoManager.createDao(connectionSource, NoteTagsModel.class);
		
		// create table
		TableUtils.createTableIfNotExists(connectionSource, NoteTagsModel.class);
	}
	
	public Dao<NoteTagsModel, Integer> getDao() {
		return noteTagsDao;
	}

}
